﻿using System;
using System.ComponentModel;

namespace CountJobTags{
    /// <summary>
    /// Suitable for binding to a checkbox
    /// </summary>
    public class SelectableCaption : INotifyPropertyChanged {
        /// <summary>Demanded by INotifyPropertyChanged</summary>
        public event PropertyChangedEventHandler PropertyChanged;
        private string _Caption;
        /// <summary>
        /// The caption to display
        /// </summary>
        public string Caption {
            get { return _Caption; }
            set {
                _Caption = value;
                if (PropertyChanged != null) {
                    PropertyChanged(this, new PropertyChangedEventArgs("Caption"));
                }
            }
        }

        private bool _IsSelected;
        /// <summary>
        /// Whether the item has been selected by user
        /// </summary>
        public bool IsSelected {
            get { return _IsSelected; }
            set {
                if (value != _IsSelected) {
                    _IsSelected = value;
                    if (PropertyChanged != null) {
                        PropertyChanged(this, new PropertyChangedEventArgs("IsSelected"));
                    }
                }
            }
        }

        private bool _IsNotDisplaySummary;
        /// <summary>Allows us to turn-off selection for one special item in the list, which displays the summary</summary>
        public bool IsNotDisplaySummary {
            get { return _IsNotDisplaySummary; }
            set { _IsNotDisplaySummary = value; }
        }

        /// <summary>
        /// Default constructor
        /// </summary>
        public SelectableCaption() {
            _IsNotDisplaySummary = true;
        }
    }
}
